package com.zaofan.service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zaofan.bean.Attr;
import com.zaofan.dao.AttrDao;

public class AttrService {

	private AttrDao attrDao = new AttrDao();

	public void delete(Attr attr) {
		attrDao.del(attr);
	}

	public void add(Attr attr) {
		attrDao.add(attr);
	}

	public void update(Attr attr) {
		attrDao.update(attr);
	}

	public List<Attr> findAll(Map<String, Object> params) {
		List<Attr> data = attrDao.findAll(params);
		if (data == null) {
			data = new ArrayList<>();
		}
		return data;
	}

	public Long count(Map<String, Object> params) {
		return attrDao.count(params);
	}

	public Attr findById(Integer id) {
		Map<String, Object> params = new HashMap<>();
		params.put("id", id);
		return attrDao.findOne(params);
	}


}
